<%@ page import="com.guotd.ticketSystem.entity.Airline" %>
<%@ page import="java.util.List" %>
<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>航线列表</title>
    <link rel="stylesheet" href="css/list.css">
</head>
<body>
<%
    if (session.getAttribute("airline_msg") != null)
    {
%>
<h2><%= session.getAttribute("airline_msg") %></h2>
<%
    }
%>
<a href="airline_add.jsp" class="table-button">添加航线信息</a>
<a href="index_admin.jsp" class="table-button">回到主页</a>
<% List<Airline> airlines= (List<Airline>) session.getAttribute("airlines"); %>
<table>
    <tr>
        <th>编号</th>
        <th>出发机场</th>
        <th>到达机场</th>
        <th colspan="2">操作</th>
    </tr>
    <%
        if(airlines!=null){
            for (Airline a : airlines) {
    %>
    <tr>
        <td> <%=a.getId()%> </td>
        <td> <%=a.getFromAirport()%> </td>
        <td> <%=a.getToAirport()%> </td>
        <td> <a href="delAirline?id=<%=a.getId()%>" class="table-button">删除</a> </td>
        <td> <a href="airline_edit.jsp?id=<%=a.getId()%>&&fromAirport=<%=a.getFromAirport()%>&&toAirport=<%=a.getToAirport()%>" class="table-button">编辑</a> </td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>